/*  -*- mode: c++; coding: utf-8; c-file-style: "stroustrup"; -*-

    Copyright 2008 Asier Aguirre <asier.aguirre@gmail.com>
    This file is part of Intromit.

    Intromit is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Intromit is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Intromit.  If not, see <http://www.gnu.org/licenses/>.
*/

#include "python_methods.hh"

python_methods::python_methods()
{
    poly_function=-1;
    sample_int=-3333;
    sample_double=7777;
}

python_methods::~python_methods()
{
}

void python_methods::sample_void()
{
}

int python_methods::add_int(int x, int y)
{
    return x+y;
}

unsigned python_methods::add_unsigned(unsigned x, unsigned y)
{
    return x+y;
}

short python_methods::add_short(short x, short y)
{
    return x+y;
}

unsigned short python_methods::add_ushort(unsigned short x, unsigned short y)
{
    return x+y;
}

char python_methods::add_char(char x, char y)
{
    return x+y;
}

unsigned char python_methods::add_uchar(unsigned char x, unsigned char y)
{
    return x+y;
}

long long python_methods::add_longlong(long long x, long long y)
{
    return x+y;
}

unsigned long long python_methods::add_ulonglong(unsigned long long x, unsigned long long y)
{
    return x+y;
}

float python_methods::add_float(float x, float y)
{
    return x+y;
}

double python_methods::add_double(double x, double y)
{
    return x+y;
}

int python_methods::sample_poly()
{
    return 3;
}

void python_methods::sample_poly(int i, int j)
{
    poly_function=1;
}

int python_methods::sample_poly(char c1, char c2, char c3, float f, double d)
{
    poly_function=2;
    return (int)(c1+c2+c3+f+d);
}

long long python_methods::sample_poly(float f)
{
    poly_function=3;
    return (long long)f;
}

double python_methods::sample_poly(double d1, double d2)
{
    poly_function=4;
    return d1*d2;
}

int python_methods::operator-()
{
    return 1;
}

int python_methods::operator+()
{
    return 2;
}

int python_methods::operator~()
{
    return 3;
}

int python_methods::operator!()
{
    return 4;
}

int python_methods::operator&()
{
    return 5;
}

int python_methods::operator++()
{
    return 6;
}

int python_methods::operator--()
{
    return 7;
}

int python_methods::operator++(int)
{
    return 8;
}

int python_methods::operator--(int)
{
    return 9;
}

int python_methods::operator+(int right)
{
    return 10+right;
}

int python_methods::operator-(int right)
{
    return 11+right;
}

int python_methods::operator*(int right)
{
    return 12+right;
}

int python_methods::operator/(int right)
{
    return 13+right;
}

int python_methods::operator%(int right)
{
    return 14+right;
}

int python_methods::operator^(int right)
{
    return 15+right;
}

int python_methods::operator&(int right)
{
    return 16+right;
}

int python_methods::operator|(int right)
{
    return 17+right;
}

int python_methods::operator<<(int right)
{
    return 18+right;
}

int python_methods::operator>>(int right)
{
    return 19+right;
}

int python_methods::operator=(int right)
{
    return 20+right;
}

int python_methods::operator+=(int right)
{
    return 21+right;
}

int python_methods::operator-=(int right)
{
    return 22+right;
}

int python_methods::operator*=(int right)
{
    return 23+right;
}

int python_methods::operator/=(int right)
{
    return 24+right;
}

int python_methods::operator%=(int right)
{
    return 25+right;
}

int python_methods::operator^=(int right)
{
    return 26+right;
}

int python_methods::operator&=(int right)
{
    return 27+right;
}

int python_methods::operator|=(int right)
{
    return 28+right;
}

int python_methods::operator<<=(int right)
{
    return 29+right;
}

int python_methods::operator>>=(int right)
{
    return 30+right;
}

int python_methods::operator==(int right)
{
    return 31+right;
}

int python_methods::operator!=(int right)
{
    return 32+right;
}

int python_methods::operator<(int right)
{
    return 33+right;
}

int python_methods::operator>(int right)
{
    return 34+right;
}

int python_methods::operator<=(int right)
{
    return 35+right;
}

int python_methods::operator>=(int right)
{
    return 36+right;
}

int python_methods::operator&&(int right)
{
    return 37+right;
}

int python_methods::operator||(int right)
{
    return 38+right;
}

// parameters by reference
int python_methods::sample_reference(int &i, float &f, double &d)
{
    int dev=i+(int)f+(int)d;
    i++;
    f*=2;
    d-=10;
    return dev;
}

// return by reference
int &python_methods::refret_int()
{
    return sample_int;
}

double &python_methods::refret_double()
{
    return sample_double;
}
